package cs271.examples.oop;

/**
 * Static methods and variables example
 *
 * @author mbone
 */
public class Statics {

    //static variable
    private static int count = 0;
    
    public Statics() {
        //We will know how many instances of this class there are:
        count++;
    }
    
    //static method
    public static int getCount() {
        return count;
    }
    
    public static void main(String[] args) {
        System.out.println("Number of instances of Statics: " + Statics.getCount());

        Statics s1 = new Statics();
        Statics s2 = new Statics();
        
        System.out.println("Number of instances of Statics: " + Statics.getCount());
    }
}
